﻿
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.ComponentModel;

using Aspectize.Core;

[assembly:AspectizeDALAssemblyAttribute]

namespace OuSuisJe
{
	public static partial class SchemaNames
	{
		public static partial class Entities
		{
			public const string Enigma = "Enigma";
			public const string User = "User";
			public const string Response = "Response";
			public const string Photo = "Photo";
			public const string CurrentUser = "CurrentUser";
		}

		public static partial class Relations
		{
			public const string Owner = "Owner";
			public const string Follows = "Follows";
			public const string Answer = "Answer";
			public const string Answered = "Answered";
			public const string PhotoEnigma = "PhotoEnigma";
			public const string IsCurrent = "IsCurrent";
		}
	}

	[SchemaNamespace]
	public class DomainProvider : INamespace
	{
		public string Name { get { return GetType().Namespace; } }
		public static string DomainName { get { return new DomainProvider().Name; } }
	}

	namespace Roles
	{
		public interface Follower { }
		public interface Following { }
	}

	[DataDefinition]
	public class Enigma : Entity, IDataWrapper
	{
		public static partial class Fields
		{
			public const string Id = "Id";
			public const string Address = "Address";
			public const string Name = "Name";
			public const string City = "City";
			public const string Country = "Country";
			public const string PostalCode = "PostalCode";
			public const string Longitude = "Longitude";
			public const string Latitude = "Latitude";
		}

		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[Data(IsPrimaryKey=true)]
		public Guid Id
		{
			get { return getValue<Guid>("Id"); }
			set { setValue<Guid>("Id", value); }
		}

		[Data(DefaultValue = "")]
		public string Address
		{
			get { return getValue<string>("Address"); }
			set { setValue<string>("Address", value); }
		}

		[Data(DefaultValue = "")]
		public string Name
		{
			get { return getValue<string>("Name"); }
			set { setValue<string>("Name", value); }
		}

		[Data(DefaultValue = "")]
		public string City
		{
			get { return getValue<string>("City"); }
			set { setValue<string>("City", value); }
		}

		[Data(DefaultValue = "")]
		public string Country
		{
			get { return getValue<string>("Country"); }
			set { setValue<string>("Country", value); }
		}

		[Data(DefaultValue = "")]
		public string PostalCode
		{
			get { return getValue<string>("PostalCode"); }
			set { setValue<string>("PostalCode", value); }
		}

		[Data]
		public long Longitude
		{
			get { return getValue<long>("Longitude"); }
			set { setValue<long>("Longitude", value); }
		}

		[Data]
		public long Latitude
		{
			get { return getValue<long>("Latitude"); }
			set { setValue<long>("Latitude", value); }
		}

	}

	[DataDefinition]
	public class User : Entity, IDataWrapper
	{
		public static partial class Fields
		{
			public const string Id = "Id";
			public const string LastName = "LastName";
			public const string FirstName = "FirstName";
			public const string Email = "Email";
			public const string UserName = "UserName";
		}

		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[Data(IsPrimaryKey=true)]
		public Guid Id
		{
			get { return getValue<Guid>("Id"); }
			set { setValue<Guid>("Id", value); }
		}

		[Data(IsNullable = true)]
		public string LastName
		{
			get { return getValue<string>("LastName"); }
			set { setValue<string>("LastName", value); }
		}

		[Data(IsNullable = true)]
		public string FirstName
		{
			get { return getValue<string>("FirstName"); }
			set { setValue<string>("FirstName", value); }
		}

		[Data(IsNullable = true)]
		public string Email
		{
			get { return getValue<string>("Email"); }
			set { setValue<string>("Email", value); }
		}

		[Data]
		public string UserName
		{
			get { return getValue<string>("UserName"); }
			set { setValue<string>("UserName", value); }
		}

	}

	[DataDefinition]
	public class Response : Entity, IDataWrapper
	{
		public static partial class Fields
		{
			public const string Id = "Id";
			public const string PostDate = "PostDate";
			public const string Content = "Content";
			public const string Longitude = "Longitude";
			public const string Latitude = "Latitude";
			public const string IsExact = "IsExact";
		}

		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[Data(IsPrimaryKey=true)]
		public Guid Id
		{
			get { return getValue<Guid>("Id"); }
			set { setValue<Guid>("Id", value); }
		}

		[Data]
		public DateTime PostDate
		{
			get { return getValue<DateTime>("PostDate"); }
			set { setValue<DateTime>("PostDate", value); }
		}

		[Data]
		public string Content
		{
			get { return getValue<string>("Content"); }
			set { setValue<string>("Content", value); }
		}

		[Data]
		public long Longitude
		{
			get { return getValue<long>("Longitude"); }
			set { setValue<long>("Longitude", value); }
		}

		[Data]
		public long Latitude
		{
			get { return getValue<long>("Latitude"); }
			set { setValue<long>("Latitude", value); }
		}

		[Data]
		public bool IsExact
		{
			get { return getValue<bool>("IsExact"); }
			set { setValue<bool>("IsExact", value); }
		}

	}

	[DataDefinition]
	public class Photo : Entity, IDataWrapper
	{
		public static partial class Fields
		{
			public const string Id = "Id";
			public const string Name = "Name";
			public const string Url = "Url";
			public const string PostDate = "PostDate";
			public const string IsResolved = "IsResolved";
		}

		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[Data(IsPrimaryKey=true)]
		public Guid Id
		{
			get { return getValue<Guid>("Id"); }
			set { setValue<Guid>("Id", value); }
		}

		[Data]
		public string Name
		{
			get { return getValue<string>("Name"); }
			set { setValue<string>("Name", value); }
		}

		[Data(IsNullable = true)]
		public string Url
		{
			get { return getValue<string>("Url"); }
			set { setValue<string>("Url", value); }
		}

		[Data]
		public DateTime PostDate
		{
			get { return getValue<DateTime>("PostDate"); }
			set { setValue<DateTime>("PostDate", value); }
		}

		[Data]
		public bool IsResolved
		{
			get { return getValue<bool>("IsResolved"); }
			set { setValue<bool>("IsResolved", value); }
		}

	}

	[DataDefinition(MustPersist = false)]
	public class CurrentUser : Entity, IDataWrapper
	{
		public static partial class Fields
		{
			public const string Id = "Id";
		}

		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[Data(IsPrimaryKey=true)]
		public Guid Id
		{
			get { return getValue<Guid>("Id"); }
			set { setValue<Guid>("Id", value); }
		}

	}

	[DataDefinition]
	[RelationPersistenceMode(SeparateTable = false)]
	public class Owner : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(User), Role = typeof(User), Multiplicity = Multiplicity.One, FkNames = "FkUser")]
		public IEntity User;

		[RelationEnd(Type = typeof(Enigma), Role = typeof(Enigma), Multiplicity = Multiplicity.ZeroOrMany)]
		public IEntity Enigma;

	}

	[DataDefinition]
	public class Follows : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(User), Role = typeof(Roles.Follower), Multiplicity = Multiplicity.ZeroOrMany)]
		public IEntity Follower;

		[RelationEnd(Type = typeof(User), Role = typeof(Roles.Following), Multiplicity = Multiplicity.ZeroOrMany)]
		public IEntity Following;

	}

	[DataDefinition]
	[RelationPersistenceMode(SeparateTable = false)]
	public class Answer : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(Response), Role = typeof(Response), Multiplicity = Multiplicity.ZeroOrMany)]
		public IEntity Response;

		[RelationEnd(Type = typeof(Enigma), Role = typeof(Enigma), Multiplicity = Multiplicity.One, FkNames = "FkEnigma")]
		public IEntity Enigma;

	}

	[DataDefinition]
	[RelationPersistenceMode(SeparateTable = false)]
	public class Answered : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(User), Role = typeof(User), Multiplicity = Multiplicity.One, FkNames = "FkUser")]
		public IEntity User;

		[RelationEnd(Type = typeof(Response), Role = typeof(Response), Multiplicity = Multiplicity.ZeroOrMany)]
		public IEntity Response;

	}

	[DataDefinition]
	[RelationPersistenceMode(SeparateTable = false)]
	public class PhotoEnigma : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(Enigma), Role = typeof(Enigma), Multiplicity = Multiplicity.One, FkNames = "Id")]
		public IEntity Enigma;

		[RelationEnd(Type = typeof(Photo), Role = typeof(Photo), Multiplicity = Multiplicity.One)]
		public IEntity Photo;

	}

	[DataDefinition(MustPersist = false)]
	public class IsCurrent : DataWrapper, IDataWrapper, IRelation
	{
		void IDataWrapper.InitData(DataRow data, string namePrefix)
		{
			base.InitData(data, null);
		}

		[RelationEnd(Type = typeof(User), Role = typeof(User), Multiplicity = Multiplicity.ZeroOrOne)]
		public IEntity User;

		[RelationEnd(Type = typeof(CurrentUser), Role = typeof(CurrentUser), Multiplicity = Multiplicity.ZeroOrOne)]
		public IEntity CurrentUser;

	}

}


  
